#include "CEC2017_F1.h"

namespace Solver
{

CEC2017_F1::CEC2017_F1(std::size_t dim):BaseTestFun(dim, FunType_E::CEC2017_F1_E, DifficultyLevel_E::Easy_E, "CEC2017_F1", "")
{
    //1. 最优解
    passY_ = 1e-12;
    bestY_ = 0;

    //2.
    description_ = "本函数是一个凸函数,求解比较简单";
}

CEC2017_F1::~CEC2017_F1()
{

}

value_t CEC2017_F1::calcMinFun(const VectorXd_t &x)
{
    const std::size_t num = x.size();
    value_t sum(0);
    for (std::size_t i = 1; i != num; ++i)
    {
        sum += x[i] * x[i];
    }

    return x[0] * x[0] + 1e6 * sum;
}

}